package com.code.qgjx.controller.viewcontroller;

import javax.mail.Session;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/Sys")
public class ViewRoute {
	@RequestMapping("/loginView")
	public String loginView(HttpSession httpSession) {
		
		return "login";
	}
	
	@RequestMapping("/loginOut")
	public String loginOut(HttpSession httpSession) {
		httpSession.removeAttribute("name");
		httpSession.removeAttribute("account");
		httpSession.removeAttribute("photo");
		return "redirect:/Sys/loginView";
	}

	@RequestMapping("/adminIndex")
	public String adminIndex(HttpSession s) {
		String perssion = s.getAttribute("role").toString();
		if(perssion.equals("admin")) {
			return "adminIndex";
		}else {
			return "redirect:/Sys/loginView";
		}
	}
	
	@RequestMapping("/stuIndex")
	public String stuIndex() {
		return "stuIndex";
	}
	
	@RequestMapping("/teacherIndex")
	public String teacherIndex() {
		return "teacherIndex";
	}

	@RequestMapping("/teacherInfo")
	public String teacherInfo() {
		return "teacherInfo";
	}

	@RequestMapping("/stuInfo")
	public String stuInfo() {
		return "stuInfo";
	}

	@RequestMapping("/adminInfo")
	public String adminInfo() {
		return "adminInfo";
	}
	
	@RequestMapping("/jobApproval")
	public String jobApproval() {
		return "jobApproval";
	}

	@RequestMapping("/register")
	public String register() {
		return "register";
	}
	@RequestMapping("/forgotPass")
	public String forgotPass() {
		return "forgotPass";
	}

	@RequestMapping("/jobDetail")
	public ModelAndView jobDetail(ModelAndView mav, @RequestParam("id") String id) {
		mav.addObject("id", id);
		mav.setViewName("jobDetail");
		return mav;
	}

	@RequestMapping("/stuAdd")
	public String StuRegister() {
		return "stuAdd";
	}

	@RequestMapping("/adminAdd")
	public String adminAdd() {
		return "adminAdd";
	}

	@RequestMapping("/adminModi")
	public ModelAndView adminModi(ModelAndView mav, @RequestParam("id") Long id) {
		mav.addObject("id", id);
		mav.setViewName("adminModi");
		return mav;
	}

	@RequestMapping("/stuModi")
	public ModelAndView stuModi(ModelAndView mav, @RequestParam("id") Long id) {
		mav.addObject("id", id);
		mav.setViewName("stuModi");
		return mav;
	}

	@RequestMapping("/teaAdd")
	public String teaAdd() {
		return "teaAdd";
	}

	@RequestMapping("/teaModi")
	public ModelAndView teaModi(ModelAndView mav, @RequestParam("id") Long id) {
		mav.addObject("id", id);
		mav.setViewName("teaModi");
		return mav;
	}


	@RequestMapping("/jobPublish")
	public String jobPublish() {
		return "jobPublishAdd";
	}


	@RequestMapping("/myJobList")
	public String myJobList() {
		return "myJobList";
	}


	@RequestMapping("/workPushList")
	public String workPushList() {
		return "workPushList";
	}



	@RequestMapping("/workPushAdd")
	public String workPushAdd() {
		return "workPushAdd";
	}
	@RequestMapping("/workPushModi")
	public String workPushModi() {
		return "workPushModi";
	}

	@RequestMapping("/workChange")
	public String workChange() {
		return "workChange";
	}

	@RequestMapping("/requestList")
	public String requestList() {
		return "requestList";
	}

	@RequestMapping("/workloadApproval")
	public String workloadApproval() {
		return "workPushAppList";
	}

	@RequestMapping("/quitApproval")
	public String quitApproval() {
		return "ResignApproval";
	}

	@RequestMapping("/workPushDetail")
	public String workPushDetail() {
		return "workPushDetail";
	}

	@RequestMapping("/resignDetail")
	public String resignDetail() {
		return "resignDetail";
	}


	@RequestMapping("/teaJob")
	public String teaJob() {
		return "teaJobList";
	}
	@RequestMapping("/stuJobList")
	public String stuJobList() {
		return "stuJob";
	}

	@RequestMapping("/welcome")
	public String welcome() {
		return "welcome";
	}

	
}
